package com.example.demo.entity;

import java.util.Date;

public class Comment {
    private Long commentId;      // 10位唯一评论ID(首位为2)
    private Long postId;         // 所属帖子ID
    private Long authorId;       // 评论者用户ID
    private String content;      // 评论内容
    private String image;        // 评论图片(可为空)
    private Date createTime;     // 创建时间
    private Integer likeCount;   // 点赞数

    // 构造方法
    public Comment() {
    }

    public Comment(Long commentId, Long postId, Long authorId, String content) {
        this.commentId = commentId;
        this.postId = postId;
        this.authorId = authorId;
        this.content = content;
        this.createTime = new Date();
        this.likeCount = 0;
    }

    // Getter和Setter方法
    public Long getCommentId() {
        return commentId;
    }

    public void setCommentId(Long commentId) {
        this.commentId = commentId;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public Long getAuthorId() {
        return authorId;
    }

    public void setAuthorId(Long authorId) {
        this.authorId = authorId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(Integer likeCount) {
        this.likeCount = likeCount;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "commentId=" + commentId +
                ", postId=" + postId +
                ", authorId=" + authorId +
                ", content='" + content + '\'' +
                ", image='" + image + '\'' +
                ", createTime=" + createTime +
                ", likeCount=" + likeCount +
                '}';
    }
}